Categories, Allegories and Circuit Design

نویسندگان

  • Carolyn Brown
  • Graham Hutton
چکیده

Relational languages such as Ruby are used to derive hardware circuits from abstract speci cations of their behaviour. Much reasoning is done informally in Ruby using pictorial representations of relational terms. We formalise this use of pictures in circuit design. We show that pictures naturally form a unitary pretabular allegory. Homomorphisms of pictures correspond to adding new wires or circuit components. Two pictures are mutually homomorphic if and only if they represent equal allegorical terms. We prove soundness and completeness results which guarantee that deriving circuits using pictures does not lead to errors. We illustrate the use of pictures by deriving the ripple adder implementation from a high level, behavioural speci cation. 1: Introduction Hardware circuit design involves translating abstract speci cations of programs into e cient circuits which compute those programs. Pictures are widely used as an informal means of translating a speci cation into an implementable circuit, and improving the layout of a circuit. A disadvantage of this informal approach is the lack of an independent means (apart from building and testing the circuit, which may be expensive and is not guaranteed to succeed) to verify that a picture indeed denotes the desired program, and that no errors have been introduced during the design process. In this paper we provide a relational semantics for pictures, together with an equivalence on pictures which shows how to transform one picture into another while preserving its semantics. The evident notion of homomorphism between pictures corresponds naturally to simple, relatively high level operations on pictures (adding new wires and components). Two pictures are provably equivalent if and only if they are mutually homomorphic, which is if and only if they denote the same relation for any interpretation of their basic components. These results lead us to a simple decision procedure for equivalence of circuits [3], which has been implemented [9]. Our results encourage the use of pictures in deriving circuits, by providing a formal foundation for that use. Pictures are easier and quicker to understand than syntactic terms, and so their use speeds up the process of circuit design. This paper illustrates these advantages in two ways, by illuminating the rather technical proof that the category of unitary pretabular allegories is isomorphic to the category of discrete cartesian bicategories, and by presenting the derivation of a ripple adder from a high level behavioural speci cation. Relations have been proposed as a paradigm for circuit development for several reasons. Relations provide a rich algebra for transforming and combining terms, and a natural treatment of non-determinism. Furthermore, in practice many methods for combining functions in networks are uni ed if the distinction between input and output is relaxed [14], and many speci cations can be expressed very naturally as representation-changers [10], that is, as the relational composition of a function with the converse of a function. Jones and Sheeran's relational calculus Ruby has been used to derive various kinds of hardware circuit from abstract behavioural speci cations: examples include systolic arrays [15], butter y networks [16] and arithmetic circuits [8, 10]. Other relational languages under development include that of Backhouse et al [1] and Bird and de Moor [2, 12]. Since these languages have the same underlying algebraic structure as Ruby, our techniques also apply to them. Much informal reasoning in Ruby depends on a pictorial interpretation of a term as a network of primitive relations, and this pictorial interpretation is crucial when Ruby is used to develop circuit layouts. This paper formalises the pictorial interpretation of Ruby terms and algebraic laws, which has not previously been made precise. Allegories abstract the notion of sets and relations rather as categories abstract the notion of sets and functions. We view pictures of circuits as arrows in a unitary pretabular allegory (upa) [5].This approach provides combinators for pictures corresponding to the operators of relational algebra, together with combinators corresponding to local products and projections. The equational axiomatisation of upas provides a notion of equivalence on pictures of circuits which corresponds to behavioural equivalence, in the sense that equivalent pictures represent equal relations. Pictures are an excellent aid to reasoning but they are unwieldy and di cult to automate: we therefore introduce networks of wires and basic components. Networks abstract from the net list model of circuit connectivity [6, 13] by ignoring the size and position of components in a circuit. In the absence of empty types, the allegory of networks and network homomorphisms is equivalent to the allegory of pictures and picture homomorphisms. Further, we prove soundness: two pictures P and P 0 denote the same relation whenever there are homomorphisms from P to P 0 and from P 0 to P; which is precisely when the pictures are provably equivalent using the axioms of a upa. Since any upa has a faithful representation in a power of Rel, the allegory of sets [3, 5], we obtain a completeness theorem stating that two pictures are provably equivalent if and only if, for every interpretation of their basic components, they denote the same relation. Soundness and completeness show that we can rely on pictures when deriving circuits. In the appendix, we picture an abstract speci cation of an adder, which cannot be implemented directly, and apply equivalences of pictures to derive a picture of a ripple adder, which is implementable using logical components. We also give a small portion of the corresponding Ruby derivation: the full derivation is explained in ten pages in [7]. By soundness, our pictorial derivation demonstrates that the two circuits compute the same relation. The pictorial derivation is much briefer than the term derivation, because each pictorial equivalence represents a long sequence of equivalences on terms. In doing the derivation, we use four additional axioms which re ect the meaning of addition. It is a feature of pictorial derivations that we can concentrate on the steps directly involving the semantics of components, as pictures abstract conveniently from repetitive applications of structural rules such as associativity. This example demonstrates the advantages of using pictures for doing derivations. The pictures are easy to read and their structure often suggests a suitable strategy for derivations. By contrast, the corresponding Ruby terms are large and di cult to read. Scanning the pictorial derivation makes clear why the circuits are equivalent and where the real work lies in proving this: to learn this information from the Ruby derivation requires careful study. Our direct correspondence between pictures and terms allows the user to think in pictures while a machine manipulates the terms. The notion of a upa is intermediate between an abstract allegory A and the regular category generated by A. A upa is of interest because it provides a sound interpretation of the axioms we have given, and embeds faithfully in a power of the allegory of sets. This embedding provides our completeness result. It might appear more natural to study the slightly stronger notion of unitary tabular allegory, since this corresponds to the same fragment of logic (conjunction and rst order existential quanti cation) while coinciding with the notion of category of relations of a regular category. However, completing a pre-tabular allegoryA to a tabular allegory involves adjoining an object for each non-maximal arrow of A. We view objects as types (including the natural numbers and booleans) and arrows as circuits which compute non-deterministic programs. Completion to a tabular allegory adds a type corresponding to each recursively enumerable function. These functions interest us as programs, but not as types: it is therefore appropriate to work in the pretabular allegory rather than in its tabular completion. In Section 2, we introduce our calculus of pictures of circuits. In Section 3 we present the allegorical axioms as an equivalence relation on pictures. In Section 4 we give the additional axioms under which our allegory of pictures is a upa in which every type is inhabited. In Section 5 we illustrate the expressive power of our language by picturing terms expressing parallel composition, bifurcation and interchange of wires, and feedback loops. In Section 6 we de ne the connectivity network underlying a picture. In Section 7 we give a relational semantics for pictures and networks. In Section 8 we give an appealing interpretation to picture homomorphisms as \addition of solder". Section 9 proves the important soundness and completeness results. Section 10 indicates future areas of research. In the Appendix we present a simple example of the derivation of an implementable circuit from a high level speci cation. 2: Pictures A picture is a graphical representation of the relationship between a given collection of basic components (cells) and their external pins (connectors) as speci ed by the ( nite, piecewise linear) wires used to connect the various pins of the components. A picture determines a relation between its input type and its output type thus: any two points on the same wire are constrained to carry equal values, while components impose more complex constraints|for example, an and gate constrains its output to be the logical and of its inputs. The notions of input (left hand) and output (right hand) pins, and the consequent notion of causality, are conventional: taking a relational rather than a functional view of circuits, we consider information to ow in more than one direction in a circuit. We write U for the empty list of connectors (the unit type). The meaning of pictures is intuitive: we omit the formal inductive de nition and merely indicate the nature of the picture constructors. A picture is either the picture C:A! B of a cell

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Categories, Allegories and Circuit Design or the Picture of a Wiring Primitive (we Often Omit the Bounding Box) 3: Axioms for Pictures

Relational languages such as Ruby are used to derive hardware circuits from abstract speciications of their behaviour. Much reasoning is done informally in Ruby using pictorial representations of relational terms. We formalise this use of pictures in circuit design. We show that pictures naturally form a unitary pretabular allegory. Homomorphisms of pictures correspond to adding new wires or ci...

متن کامل

A First-Order Calculus for Allegories

In this paper we a language and first-order calculus for formal reasoning about relations based on the theory of allegories. Since allegories are categories the language is typed in Church-style. We show soundness and completeness of the calculus and demonstrate its usability by presenting the RelAPS system; a proof assistant for relational categories based on the calculus presented here.

متن کامل

Allegories of Circuits

This paper presents three paradigms for circuit design, and investigates the relationships between them. These paradigms are syntactic (based on Freyd and Scedrov's unitary pre-tabular allegories (upas)), pictorial (based on the net list model of circuit connectivity), and relational (based on Sheeran's relational model of circuit design Ruby). We show that net lists over a given signature cons...

متن کامل

Refactoring Heterogeneous Relation Algebras around Ordered Categories and Converse

We present a reorganisation of popular theories of “reasoning with relational flavour”, including allegories, Kleene algebras, and Dedekind categories, into an relatively symmetric picture using ordered categories as common base and defining converse independently from joins and meets. As an example application, we use this to regroup results about formalisation of algebraic graph rewriting and...

متن کامل

Modalities for an Allegorical Conceptual Data Model

Allegories are enriched categories generalizing a category of sets and binary relations. In this paper, we extend a new, recently-introduced conceptual data model based on allegories by adding support for modal operators and developing a modal interpretation of the model in any allegory satisfying certain additional (but natural) axioms. The possibility of using different allegories allows us t...

متن کامل

Weak n-Ary Relational Products in Allegories

Abstract: Allegories are enriched categories generalizing a category of sets and binary relations. Accordingly, relational products in an allegory can be viewed as a generalization of Cartesian products. There are several definitions of relational products currently in the literature. Interestingly, definitions for binary products do not generalize easily to n-ary ones. In this paper, we provid...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994